package com.springboot.application.response;

import com.springboot.application.enums.ResultCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class ResultResponse {


    private int code;

    private String msg;

    private Object data;


    public ResultResponse(Object data){
        this.data = data;
        this.code = ResultCodeEnum.SUCCESS.getCode();
        this.msg = ResultCodeEnum.SUCCESS.getMsg();
    }


    public ResultResponse(Object data,ResultCodeEnum resultCodeEnum){
        this.data = data;
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMsg();
    }


    public ResultResponse(ResultCodeEnum resultCodeEnum){
        this.data = null;
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMsg();
    }
}
